# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=libcerf
pkgver=2.4
pkgrel=0
pkgdesc="Self-contained complex error function library"
url="https://jugit.fz-juelich.de/mlz/libcerf/"
arch="all"
license="MIT"
makedepends="cmake perl samurai"
subpackages="$pkgname-dev $pkgname-doc"
source="https://jugit.fz-juelich.de/mlz/libcerf/-/archive/v$pkgver/libcerf-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
0e78a18c498705d5efa26e504932192c4d49485cc3f971235c86c4dc6ca7498063f33e188a55f4c939e25d0d2a2f215b22ef11d3776d80a4a7486ea62fad1d73  libcerf-v2.4.tar.gz
"
